package com.sec.etech.chain.customergroup.util;

import cn.hutool.core.util.StrUtil;
import com.sec.etech.chain.customergroup.mapper.CustomerGroupMapper;
import org.openbpm.base.core.util.AppUtil;

public class CustomerGroupUtil {


    public static String getNextCode(){
        CustomerGroupMapper customerGroupMapper = AppUtil.getBean(CustomerGroupMapper.class);
        String currentCode = customerGroupMapper.getCurrentCode();

        if (StrUtil.isBlankOrUndefined(currentCode)){
            return "PCG00001";
        }

        Integer endNum = Integer.parseInt(currentCode.substring(3));
        return "PCG" + String.format("%05d", endNum + 1);
    }

}
